import unittest
from AStock.ASUtil import date_to_dot_format, date_to_bar_format, \
    date_from_bar_format, date_from_dot_format


class TestUtil(unittest.TestCase):

    def testDateConvert(self):
        date = '20200331'
        self.assertEqual(date_to_dot_format(date), '2020.03.31')
        self.assertEqual(date_to_bar_format(date), '2020-03-31')
        date = '2020-03-31'
        self.assertEqual(date_from_bar_format(date), '20200331')
        date = '2020.03.31'
        self.assertEqual(date_from_dot_format(date), '20200331')